package GameItem.Tank
{
	import Cotrol.GameTickControl;
	
	import GameItem.AGameItem;
	import GameItem.Direction.Direction;
	import GameItem.Direction.DirectionFactory;
	import GameItem.IGameItem;
	
	import View.GameBattle;
	
	import flash.display.Bitmap;
	import flash.display.Loader;
	import flash.events.Event;
	import flash.events.KeyboardEvent;
	import flash.geom.Point;
	import flash.net.URLRequest;
	
	public class Tank extends AGameItem implements ITank
	{
		protected var m_speed:int;
		protected var m_hp:int;
//		protected var m_bullet:Bullet;
//		protected var m_specialEffact:SpecialEffact;
		public function Tank()
		{
			super();
			m_itemDisplay=new TankDisplay();
			
			GameBattle.gameStage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);
			
			m_grid=new Point();
		}
		private function onKeyDown(evt:KeyboardEvent):void
		{
			trace(evt.keyCode);//==KeyCode
			switch(evt.keyCode)
			{
				case 87:
					moveToDirection(DirectionFactory.UP);
					break;
				case 83:
					moveToDirection(DirectionFactory.DOWN);
					break;
				case 65:
					moveToDirection(DirectionFactory.LEFT);
					break;
				case 68:
					moveToDirection(DirectionFactory.RIGHT);
					break;
			}
		}
		
		public function moveToDirection(direction:Direction):void
		{
			direction.moveGameItem(this as IGameItem,m_speed);
		}
		
		public function shot():void
		{
		}
		
		public function die():void
		{
		}
	}
}